package com.ruoyi.project.purchase.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.purchase.domain.P_drug;
import com.ruoyi.project.purchase.service.FactoriessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/supchase/stockinquiry")
public class stockInquiryController extends BaseController {
    @Autowired
    private FactoriessService factoriessService;

    @RequestMapping("findFactory")
    public AjaxResult findFactory(){
        return AjaxResult.success(factoriessService.getAllFactorysType());
    }

    @RequestMapping("findAllDrug")
    public TableDataInfo findAllDrug(P_drug p_drug){
        return getDataTable(factoriessService.getAllDrugs(p_drug));
    }

    @RequestMapping("findAllPurDrugFac")
    public TableDataInfo findAllPurDrugFac(@RequestBody P_drug p_drug){
        System.out.println(p_drug.getParams());
        return getDataTable(factoriessService.findAllPurDrugFac(p_drug));
    }
}
